<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户管理</title>
  <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
  <script type="text/javascript" th:src="@{/js/jquery.js}"></script>
  <script type="text/javascript" th:src="@{/laydate/laydate.js}"></script>
<script type="text/javascript">
  function deltipOpen(ele) {
    $("#deltip").fadeIn(200);
    $("#orderid2").val($(ele).prev().val());
  }
  function deltipClose() {
      $("#deltip").fadeOut(200);
  }
  function deltipQueding() {
    $("#deltip").fadeOut(200);
    var orderid = $("#orderid2").val();
    window.location.href="/erp1/market/orders/delOrders?orderid="+orderid;
  }
function examinetipOpen(ele) {
  $("#examinetip").fadeIn(200);
  var oid = $(ele).prev().val();
  $("#oid2").val(oid);
}
function examinetipclose() {
	$("#examinetip").fadeOut(200);
}
  function examinetipQueding() {
    $("#examinetip").fadeOut(200);
    var oid = $("#oid2").val();
    //var uid = $("#uid").val();
    window.location.href="/erp1/market/orders/updateStatus?orderid="+oid;
  }
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>营销管理</li>
    <li>订购单管理</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form action="/erp1/market/orders/ordersAll" method="post" id="ordersform">
    <input type="hidden" name="pageno" value="1" id="pageno"/>
    <ul class="tools">
      <li> 订单编号:
        <input type="text" name="orderid" th:value="${orders.orderid}"/>
      </li>
      <li> 客户姓名:
        <input type="text" name="custom.customname" th:value="${orders.custom!=null?orders.custom.customname:''}"/>
      </li>
      <li> 订购时间:
        <input type="date" name="ordertimemin" th:value="${ordertimeMin}" /> -
        <input type="date" name="ordertimemax" th:value="${ordertimeMax}" />
      </li>
      <li> 金额:
        <input type="text" class="stinput" name="ordermoneyMin"  th:value="${ordermoneyMin}"/> -
        <input type="text" class="stinput" name="ordermoneyMax " th:value="${ordermoneyMax}"/>
      </li>
      <li> 审核状态：
        <select name="status">
          <option value="">请选择</option>
          <option th:value="0" th:selected="${orders.status=='0'}?'true':'false'">未审核</option>
          <option th:value="1" th:selected="${orders.status=='1'}?'true':'false'">审核中</option>
          <option th:value="2" th:selected="${orders.status=='2'}?'true':'false'">审核通过</option>
          <option th:value="3" th:selected="${orders.status=='3'}?'true':'false'">审核未通过</option>
        </select>
      </li>
      <li class="subBut" onclick="goPage(1)"><img th:src="@{/images/t06.png}"  />查询</li>
      <li class="subBut" onclick="window.location.href='/erp1/market/order/orderAdd'"><img th:src="@{/images/t01.png}" />添加</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>订单编号</th>
          <th>客户姓名</th>
          <th>联系电话</th>
          <th>订购时间</th>
          <th>金额</th>
          <th>操作人</th>
          <th>审核状态</th>
          <th>审核人</th>
          <th>审核时间</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
      <tr th:each="o,var : ${Opinfo.list}">
        <td th:text="${(Opinfo.pageNum-1)*Opinfo.pageSize+var.count}">1</td>
        <td th:text="${o.orderid}">DJ201701270001</td>
        <td th:text="${o.custom.customname}">王金平</td>
        <td th:text="${o.custom.telephone}">17370899727</td>
        <td th:text="${#dates.format(o.ordertime,'yyyy/MM/dd')}">2017-01-25 15:05:05</td>
        <td th:text="${o.ordermoney}">￥9,876,582</td>
        <td th:text="${o.operatorUser.uname}">关羽</td>

        <!--<td th:text="${o.status=='0'?'未审核':(o.status=='1'?'审核中':(o.status=='2'?'审核通过':'审核不通过'))}">未审核</td>-->

        <td th:if="${o.status=='0'}">未审核</td>
        <td th:if="${o.status=='1'}">审核中</td>
        <td th:if="${o.status=='2'}">审核通过</td>
        <td th:if="${o.status=='3'}">审核不通过</td>


        <td th:text="${o.checkid==null?'':o.checkUser.uname}"></td>
        <td th:text="${#dates.format(o.chectime,'yyyy/MM/dd')}"></td>


        <td th:if="${o.status=='0'}">
          <a th:href="@{'/market/orders/ordersDetails?orderid='+${o.orderid}}" class="tablelink">查看详情</a>
          <a th:href="@{'/market/orders/goUpdateOrders?orderid='+${o.orderid}}" class="tablelink">修改</a>
          <input th:value="${o.orderid}" type="hidden"/>
          <a href="javascript:void(0);" class="tablelink" onclick="deltipOpen(this)">删除</a>
          <input th:value="${o.orderid}" type="hidden"/>
          <a href="javascript:void(0);" class="tablelink" onclick="examinetipOpen(this)">提交审核</a>
        </td>
        <td th:if="${o.status=='1'}">
          <a th:href="@{'/market/orders/ordersDetails?orderid='+${o.orderid}}" class="tablelink">查看详情</a>
        </td>
        <td th:if="${o.status=='2'}">
          <a th:href="@{'/market/orders/ordersDetails?orderid='+${o.orderid}}" class="tablelink">查看详情</a>
          <a th:href="'/erp1/rep/ckware/detail/'+${o.warehouseId}" class="tablelink">出库详情</a>
        </td>
        <td th:if="${o.status=='3'}">
          <a th:href="@{'/market/orders/goUpdateOrders?orderid='+${o.orderid}}" class="tablelink">修改</a>
          <input th:value="${o.orderid}" type="hidden"/>
          <a href="javascript:void(0);" class="tablelink" onclick="examinetipOpen(this)">提交审核</a>
        </td>
      </tr>
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue" th:text="${Opinfo.total}"></i>条记录，当前显示第&nbsp;<i class="blue" th:text="${Opinfo.pageNum}">2&nbsp;</i>页</div>
      <ul class="paginList">
          <li class="paginItem">
              <a href="javascript:void(0);" th:onclick="goPage([[${Opinfo.isFirstPage?1:Opinfo.pageNum-1}]])">
                  <span th:class="${Opinfo.isFirstPage?'pagepre':'pagenxt roate'}"></span>
              </a>
          </li>

          <li th:class="${page==Opinfo.pageNum?'paginItem current':'paginItem'}"
              th:each="page : ${Opinfo.navigatepageNums}">
            <a href="javascript:;"  th:text="${page}" th:onclick="goPage([[${page}]])">1</a>
          </li>

          <li class="paginItem">
            <a href="javascript:void(0);" th:onclick="goPage([[${Opinfo.isLastPage?Opinfo.pages:Opinfo.pageNum+1}]])">
              <span th:class="${Opinfo.isLastPage?'pagepre roate':'pagenxt'}"></span>
            </a>
          </li>
      </ul>
    </div>
  </form>
  <!-- 删除提示框 -->
  <div id="deltip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="deltipClose()"></a></div>
    <div class="tipinfo"> <span><img th:src="@{/images/ticon.png}"/></span>
      <div class="tipright">
        <p>是否确认删除此条信息？</p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input type="hidden" id="orderid2"/>
      <input name="" type="button"  class="sure" value="确定" onclick="deltipQueding()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="deltipClose()" />
    </div>
  </div>

  <!-- 审批提示框 -->
  <div id="examinetip" class="tip">
    <div class="tiptop">
    	<span>提示信息</span><a onclick="examinetipclose()"></a>
    </div>
    <div class="tipinfo1">

        部门：
            <select class="dfselect">
            	<option>请选择</option>
                <option selected>市场部</option>
            </select>
			<p/>
            职位：
            <select class="dfselect">
            	<option>请选择</option>
                <option selected>部门经理</option>
                <option>组长</option>
                <option>组员</option>
            </select>
   			<p/>
            姓名：
            <select class="dfselect" >
            	<option>请选择</option>
                <option th:each="u :${usersList}" th:text="${u.uname}" th:value="${u.uId}"></option>
            </select>
			<p/>
    </div>
    <div class="tipbtn">
      <input type="hidden" id="oid2"/>
      <input name="" type="button"  class="sure" value="确定" onclick="examinetipQueding()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="examinetipclose()" />
    </div>
  </div>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');

    function goPage(num) {
      // alert(num);
      $("#pageno").val(num);
      $("#ordersform").submit();
    }
</script>
</body>
</html>
